﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThucThe;
using System.Data;
namespace KetNoi
{
    public class DiaDanh_ketnoi
    {
        clsKetNoi kn = new clsKetNoi();
        public DataTable danhSachDiaDanh()
        {
            return kn.LayDuLieu("DiaDanh_load");
        }
        public DataTable timDiaDanh(DiaDanh_thucthe dd)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenDiaDanh";
            value[0] = dd.TenDiaDanh;
            return kn.TimKiem("DiaDanh_tim", name, value, Nparameter);
        }
        public int Them_DiaDanh(DiaDanh_thucthe dd)
        {
            int Nparameter = 3;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@tenDiaDanh"; value[0] = dd.TenDiaDanh;
            name[1] = "@moTa"; value[1] = dd.MoTa;
            name[2] = "@diaChi"; value[2] = dd.DiaChi;
            return kn.CapNhat("DiaDanh_them", name, value, Nparameter);
        }
        public int Sua_DiaDanh(DiaDanh_thucthe dd)
        {
            int Nparameter = 4;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maDiaDanh"; value[0] = dd.MaDiaDanh;
            name[1] = "@tenDiaDanh"; value[1] = dd.TenDiaDanh;
            name[2] = "@moTa"; value[2] = dd.MoTa;
            name[3] = "@diaChi"; value[3] = dd.DiaChi;
            return kn.CapNhat("DiaDanh_sua", name, value, Nparameter);
        }
          public int Xoa_DiaDanh(DiaDanh_thucthe dd)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@maDiaDanh";
            value[0] = dd.MaDiaDanh;
            return kn.CapNhat("DiaDanh_xoa", name, value, Nparameter);
        }
    }
}
